<?php

/**
 *      [Ʒ�ƿռ�] (C)2001-2010 Comsenz Inc.
 *      This is NOT a freeware, use is subject to license terms
 *
 *      $Id: perm.inc.php 4238 2010-08-23 06:49:46Z yumiao $
 */

if(!defined('IN_ADMIN') && !defined('IN_STORE')) {
	exit('Access Denied');
}

$isfounder = isset($isfounder) ? $isfounder : isfounder();

$topmenu = $menu = array();

$topmenu = array (
	'index' => '',
	'global' => '',
	'catmanage' => '',
	'shop' => '',
	'infomanage' => '',
	'admintools' => ''
);
$menu['index'] = array(
	array('menu_home', 'index'),
	array('menu_shop', 'list&m=shop'),
	array('menu_good', 'list&m=good'),
	array('menu_notice', 'list&m=notice'),
	array('menu_album', 'list&m=album'),
	array('menu_consume', 'list&m=consume'),
	array('menu_groupbuy', 'list&m=groupbuy'),
);

$menu['global'] = array(
	array('menu_global_basic', 'global&op=basic'),
	array('menu_attach', 'attach'),
	array('menu_imgwater', 'imgwater'),
	array('menu_ads', 'ads'),
	array('menu_domain', 'domain'),
	array('menu_commentmodel', 'commentmodel'),
	array('menu_nav', 'nav'),
	array('menu_attr', 'attr'),
	array('menu_global_censor', 'censor'),
	array('menu_uc_discuz', 'discuz'),
	array('menu_block', 'block'),
	array('menu_ec', 'ec&op=tenpay'),
	array('menu_xmlpost', 'xmlpost'),
	array('menu_verify', 'verify'),
);

$menu['catmanage'] = array(
	array('menu_category_shop', 'category&type=shop'),
	array('menu_category_region', 'region'),
	array('menu_category_good', 'category&type=good'),
	array('menu_category_album', 'category&type=album'),
	array('menu_category_consume', 'category&type=consume'),
	array('menu_category_groupbuy', 'category&type=groupbuy'),
	array('menu_category_notice', 'category&type=notice'),
);

$menu['shop'] = array(
	array('menu_shop', 'list&m=shop'),
	array('menu_home_joinmod', 'list&m=shop&grade=0&optpass=1&filtersubmit=GO'),
	array('menu_list_addshop', 'add&m=shop&op=basic'),
	array('menu_group', 'group'),
	array('menu_correctioninfo', 'correctioninfo'),
	
);

$menu['infomanage'] = array(
	array('menu_good', 'list&m=good'),
	array('menu_album', 'list&m=album'),
	array('menu_consume', 'list&m=consume'),
	array('menu_notice', 'list&m=notice'),
	array('menu_comment', 'comment'),
	array('menu_report', 'report'),
	array('menu_groupbuy', 'list&m=groupbuy'),
	array('menu_brandlinks', 'brandlinks'),
	array('menu_shopmapmark', 'shopmapmark'),
	array('menu_reserve', 'reserve'),
	array('menu_shoptag', 'shoptag'),
);
$menu['admintools'] = array(
	array('menu_tool_updatecache', 'tool&operation=updatecache'),
	array('menu_tool_sitenotice', 'sitenotice'),
	array('menu_tool_adv', 'adv'),
	array('menu_db', 'db&operation=export'),	
	array('menu_logs', 'logs&operation=admin'),
	array('menu_tool_updateshopitemnum', 'tool&operation=updateshopitemnum'),	
	array('menu_tool_cron', 'tool&operation=cron'),
);
if($isfounder) {
	$menu['admintools'][] = array('menu_perm', 'perm');
}

if(!isfounder() && !isset($_SGLOBAL['adminsession']['perms']['all'])) {
	$menunew = $menu;
	foreach($menu as $topkey => $datas) {
		$itemexists = 0;
		foreach($datas as $key => $data) {
			if($data[1] == 'index') {
				$itemexists = 1;
				continue;
			}
			if(array_key_exists($data[1], $_SGLOBAL['adminsession']['perms'])) {
				$itemexists = 1;
			} else {
				unset($menunew[$topkey][$key]);
			}
		}
		if(!$itemexists) {
			unset($topmenu[$topkey]);
			unset($menunew[$topkey]);
		}
	}
	$menu = $menunew;
}

function isfounder() {
	global $_G, $_SGLOBAL;
	return ckfounder($_G['uid']);
}

?>
